<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h1>The Ajax 03 Page</h1>
    <button onclick="doAjaxGet()">doGet</button>
    <button onclick="doAjaxPost()">doPost</button>
    <button onclick="doAjaxDelete()">doDelete</button>
    <button onclick="doAjaxPut()">doPut</button>

    <!--服务器返回结果更现在下方-->
    <div id="result">
    </div>

    <script src="/js/ajax.js"></script>

    <script type="text/javascript">
        function doAjaxGet() {
            let url = "http://localhost/doAjaxGet";
            let params = "";
            ajaxGet(url, params,function (result) {
                document.getElementById("result").innerText = result;
            })
        }

        function doAjaxPost() {
            let url = "http://localhost/doAjaxPost";
            let params = "id=12&name=电脑&remark=双11最低五折";
            ajaxPost(url, params,function (result) {
                document.getElementById("result").innerText = result;
            })
        }

        function doAjaxDelete() {
            let url = "http://localhost/doAjaxDelete";
            let params = "id=100";
            ajaxDelete(url, params,function (result) {
                document.getElementById("result").innerText = result;
            })
        }

        function doAjaxPut() {
            let url = "http://localhost/doAjaxUpdate";
            let params = "id=12&name=华为&remark=麒麟970";
            ajaxUpdate(url, params,function (result) {
                document.getElementById("result").innerText = result;
            })
        }
    </script>

</body>
</html>